package com.kaifamiao.service.impl;

import com.kaifamiao.entity.Customer;
import com.kaifamiao.mapper.CustomerMapper;
import com.kaifamiao.service.CustomerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class CustomerServiceImpl implements CustomerService {

    private CustomerMapper customerMapper;

    @Override
    public boolean save(Customer c) {
        int count = customerMapper.persist( c );
        return count == 1;
    }

    public CustomerMapper getCustomerMapper() {
        return customerMapper;
    }

    // 根据类型自动装配
    @Autowired
    public void setCustomerMapper(CustomerMapper customerMapper) {
        this.customerMapper = customerMapper;
    }
}
